-
-
Notifications
You must be signed in to change notification settings - Fork 788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix[codegen]: fix false positive in risky call detection #4160
base: master
Are you sure you want to change the base?
fix[codegen]: fix false positive in risky call detection #4160
Conversation
the `potential_overlap` and `read_write_overlap()` functions use `contains_risky_call` to detect if there is potential for reentrancy. however, when the target is a precompile, there is no chance for reentrancy, so we filter them out of the detector.
--------- Co-authored-by: Hubert Ritzdorf <[email protected]> Co-authored-by: trocher <[email protected]>
vyper/codegen/ir_node.py
Outdated
@@ -13,6 +13,8 @@ | |||
from vyper.semantics.types import VyperType | |||
from vyper.utils import VALID_IR_MACROS, ceil32 | |||
|
|||
PRECOMPILE_RANGE = (1, 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might not be true for some L2s
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i thought about this (see also eip-7587) but i think it's ok.
- we can't predict every precompile that will be in use by an L2
- precompiles could have arbitrary effects
- our main goal here is to protect against precompiles which could be generated in the compiler. user-generated calls to precompiles are fair game (we can consider them "unsafe")
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4160 +/- ##
===========================================
- Coverage 91.34% 43.85% -47.50%
===========================================
Files 109 109
Lines 15606 15616 +10
Branches 3432 3434 +2
===========================================
- Hits 14256 6849 -7407
- Misses 920 8251 +7331
- Partials 430 516 +86 ☔ View full report in Codecov by Sentry. |
the
potential_overlap
andread_write_overlap()
functions usecontains_risky_call
to detect if there is potential for reentrancy. however, when the target is a precompile, there is no chance for reentrancy, so we filter them out of the detector.What I did
How I did it
How to verify it
Commit message
Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)
Description for the changelog
Cute Animal Picture